﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge chrome=1">
    <link href="../../Css/bootstrap.min.css" rel="stylesheet" />
    <link href="../../Css/bootstrap-table.css" rel="stylesheet" />
    <link href="../../Css/base.css" rel="stylesheet" />
    <link href="../../Css/tail.css" rel="stylesheet" />
    <link href="../../Css/info-mgt.css" rel="stylesheet" />
    <script src="../../Script/jquery.min.js"></script>
    <script src="../../Script/jquery.form.js"></script>
    <script src="../../Script/bootstrap.min.js"></script>
    <script src="../../Script/bootstrap-table.js"></script>
    <script src="../../Script/bootstrap-table-zh-CN.min.js"></script>
    <script src="../../Script/layer.js"></script>
    <script src="../Js/Quartz_Add_Js.js"></script>
    <title></title>
    <style>
        /**字符串过长 转化为 。。。**/
        table {
            width: 100px;
            table-layout: fixed;
            /* 只有定义了表格的布局算法为fixed，下面td的定义才能起作用。 */
        }

        td {
            width: 100%;
            word-break: keep-all;
            /* 不换行 */
            white-space: nowrap;
            /* 不换行 */
            overflow: hidden;
            /* 内容超出宽度时隐藏超出部分的内容 */
            text-overflow: ellipsis;
            /* 当对象内文本溢出时显示省略标记(...) ；需与overflow:hidden;一起使用*/
            -o-text-overflow: ellipsis;
            -icab-text-overflow: ellipsis;
            -khtml-text-overflow: ellipsis;
            -moz-text-overflow: ellipsis;
            -webkit-text-overflow: ellipsis;
        }
        bt-ss{

        }
    </style>
</head>
<body style="border-radius: 8px">
    <form name="form1" id="form1" method="post" enctype="multipart/form-data">
        <div class="top">
            <div class="l_left" style="width: 100%">
                <table class="table">
                    <tbody>
                        <tr>
                            <td class="td1" style="width:15%">
                                <font class="bt" id="JOBSNAMEbt" style="display:none" color="red">*</font><label>执行程序名称：</label>
                            </td>
                            <td class="td2" style="width:85%">

                                <input id="JOBSNAME" name="JOBSNAME" type="text" placeholder="执行程序名称" style="width:95%">
                                <!--<input  type="file" style="width:100px;float:right;text-align:center;" value="选择" />-->
                            </td>


                        </tr>
                        <tr>
                            <td class="td1" style="width:15%">
                                <font class="bt" id="JOBCRONbt" style="display:none" color="red">*</font><label>执行程序时间：</label>
                            </td>
                            <td class="td2" style="width:85%">

                                <input id="JOBCRON" name="JOBCRON" readonly="readonly" onclick="createrCron()" type="text" placeholder="执行程序时间" style="width:95%">
                            </td>


                        </tr>
                        <tr>
                            <td style="text-align: right" height="60px"><font class="bt" id="JOBJJbt" style="display:none" color="red">*</font><label>任务简介：</label></td>
                            <td colspan="6" style="text-align: left" height="60px">
                                <textarea id="JOBJJ" name="JOBJJ" rows="3" cols="20" style="width: 97%; height: 50px;"></textarea>

                            </td>
                        </tr>
                        <tr>
                            <td class="td1" style="width:15%;">
                                <font class="bt" id="JOBCRONbt1" style="display:none" color="red">*</font><label>执行程序：</label>
                            </td>
                            
                            <td class="td2" style="width:85%">
                                <input id="postfile" style="BORDER-TOP-STYLE: groove; BORDER-RIGHT-STYLE: groove; BORDER-LEFT-STYLE: groove; BORDER-BOTTOM-STYLE: groove;width:300px;display:inline;"
                                       type="file" name="postfile" multiple="multiple" onchange="xzwj(this)">
                                <ul class="list-group" id="ulFile" style="margin-top:10px;">
                                    <!--<li class="list-group-item">Cras justo odio <input class="btn btn-danger btn-xs" type="button" style="width:50px;float:right;text-align:center;" value="删除" /></li>
                                    <li class="list-group-item">Dapibus ac facilisis in</li>
                                    <li class="list-group-item">Morbi leo risus</li>
                                    <li class="list-group-item">Porta ac consectetur ac</li>
                                    <li class="list-group-item">Vestibulum at eros</li>-->
                                </ul>
                               
                               
                            </td>

                            <td>
                                
                            </td>
                        </tr>
                        


                        <tr>
                            <!--<td class="td1"><label>附件：</label></td>
                            <td class="td2" colspan="8">
                                <iframe id="fjinfo" src="upload.html"
                                        frameborder="0" scrolling="no" width="100%" height="50"></iframe>
                            </td>-->
                        </tr>



                    </tbody>
                </table>
            </div>
            <div class="bot_btn">
                <!--
                <input class="btn btn1" name="fw_submit" id="SaveForm" type="submit" value="保存">
                <input class="btn btn1" name="fw_submit" id="SendForm" type="submit" value="发送">
                 -->
                <input class="btn btn2" id="submit1" type="button" onclick="form_Save()" value="确定" />
                <!--<input class="btn btn2" id="submit" type="button" onclick="form_Close()" value="取消" />-->

            </div>
            <div>
                <label>
                    <input id="NGUID" name="NGUID" type="hidden" value="">
                    <input id="OPERATETOR" name="OPERATETOR" type="hidden" value="">
                    <input id="OPERATETORNAME" name="OPERATETORNAME" type="hidden" value="">
                </label>
            </div>

        </div>
    </form>
    <script language="javascript">
        var urls = "http://localhost/WebApi/api/";

        //验证-> 发送验证—1
        function form_Save() {
            $(".btn btn2").attr('disabled', true);
            var JOBSNAME = $("#JOBSNAME").val();
            var JOBCRON = $("#JOBCRON").val();
            var JOBJJ = $("#JOBJJ").val();
            //var BZ = $("#BZ").val();
            var ts = 0;

            $('.bt').hide();

            if (JOBSNAME == '') {
                $('#JOBSNAME' + 'bt').show();
                ts += 1;
            } if (JOBCRON == '') {
                $('#JOBCRON' + 'bt').show();
                ts += 1;
            } if (JOBJJ == '') {
                $('#JOBJJ' + 'bt').show();
                ts += 1;
            }
            if (count == 0) {
                $('#JOBCRONbt1').show();
                ts += 1;
            }

            //if (YCRQ == '' || SQKSBH == '' || SQKS == '' || CXRY == '' || CXRS == '' || YCLY == '' || CCSJ == '' || JBR == '' || CCDD == '' || MDDD == '' ) {

            //    ts += 1;
            //}

            if (ts > 0) {
                layer.msg('页面有必填项未填写', {
                    icon: 7
                });
            } else {
                //if (!isNumber(CXRS)) {
                //    layer.msg('出行人数必须为数字', {
                //        icon: 7
                //    });
                //} else {
                Save();
                //}
            }

        }

        //->>发送 -2
        function Save() {
            //var o_Editor = document.getElementById("eWebEditor1").contentWindow;
            //$("#eWebEditor_Content").val(o_Editor.getHTML());

            //var formElement = document.getElementById('form1');

            var JOBSNAME = $("#JOBSNAME").val();
            var JOBCRON = $("#JOBCRON").val();
            var JOBJJ = $("#JOBJJ").val();
            var NGUID = $("#NGUID").val();
            var formElement = document.getElementById('form1');
            //var formElement = JSON.stringify({ "JOBSNAME": JOBSNAME, "JOBCRON": JOBCRON, "JOBJJ": JOBJJ, "NGUID": NGUID });
            var urls1 = '';
            var type = getUrlParam('type');
            if (type == "add") {
                urls1 = urls + 'JobInfo/InsertJob';
            } else if (type = 'edit') {
                urls1 = urls + 'JobInfo/UpdateJobInfo';
            }

            if (CheckCron(JOBCRON)) {
                // var formData = formElement;
                var formData = new FormData(formElement);
                $.ajax({
                    url: urls1,
                    type: 'POST',
                    //contentType: 'application/json',
                    data: formData,
                    dataType: "json",
                    processData: false, //tell jQuery not to process the data
                    contentType: false, //tell jQuery not to set contentType
                    //这儿的三个参数其实就是XMLHttpRequest里面带的信息。
                    layerIndex: -1,
                    beforeSend: function () { //插件加载前
                        this.layerIndex = layer.load(0, { shade: [0.01, '#fff'] });
                        $('#submit1').val("正在保存");
                    },
                    success: function (data) {

                        if (data.code == 200) {
                            if (type == 'edit') {
                                parent.layer.msg('修改成功！', {
                                    icon: 1
                                });
                            } else {
                                parent.layer.msg('添加成功！', {
                                    icon: 1
                                });
                            }

                            //parent.load();
                            parent.layer.closeAll('iframe'); //关闭所有的iframe层

                        } else {
                            $('#submit1').val("确定");
                            layer.msg(data.msg, {
                                icon: 2
                            });
                        }

                        //if (arg == "success") {
                        //    parent.fwcloseLayer1();
                        //} else {
                        //    layer.msg(arg, {
                        //        icon: 2
                        //    });
                        //}
                        $(".btn btn2").attr('disabled', false);
                    },
                    complete: function () { //完成加载后执行
                        layer.close(this.layerIndex); //完成加载后关闭loading
                    }

                });
            }
            
        };

        function form_Close() {
            parent.layer.closeAll('iframe'); //关闭所有的iframe层
        }

        function isNumber(value) {         //验证是否为数字
            var patrn = /^\+?[1-9][0-9]*$/;
            if (patrn.exec(value) == null || value == "") {
                return false
            } else {
                return true
            }
        }

        // #region 限制输入为数字
        function clearNoNum(obj) {
            //先把非数字的都替换掉，除了数字和.
            obj.value = obj.value.replace(/[^\d.]/g, "");
            //必须保证第一个为数字而不是.
            obj.value = obj.value.replace(/^\./g, "");
            //保证只有出现一个.而没有多个.
            obj.value = obj.value.replace(/\.{2,}/g, ".");
            //保证.只出现一次，而不能出现两次以上
            obj.value = obj.value.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");
            //$("#JYJE").val($("#DJ").val() * $("#JYL").val());
        }
        // #endregion

    </script>
</body>

</html>
